Improve error message for missing franc-min dependency#60
Conversation
Co-authored-by: EthanThePhoenix38 <103653068+EthanThePhoenix38@users.noreply.github.com>
Co-authored-by: EthanThePhoenix38 <103653068+EthanThePhoenix38@users.noreply.github.com>
…ting Co-authored-by: EthanThePhoenix38 <103653068+EthanThePhoenix38@users.noreply.github.com>
…-pr-57-another-one
e9928c7
into
claude/configurable-news-reader-G1Gdx
There was a problem hiding this comment.
Pull request overview
Updates the runtime warning emitted when the optional franc-min dependency is unavailable, so users get actionable guidance to restore automatic language detection.
Changes:
- Replaced the generic
franc-min not available...log with a clearer warning. - Added an instruction telling users to run
npm installto resolve the missing dependency.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| console.error('WARNING: franc-min package not found. Language detection will be limited to feed-declared languages only.'); | ||
| console.error('To enable automatic language detection, please run: npm install'); |
There was a problem hiding this comment.
The catch (e) currently assumes any failure means franc-min is missing and logs "package not found". If require('franc-min') throws for another reason (e.g., corrupted install or unexpected runtime error), this message will be misleading and the real error will be masked. Consider checking e.code === 'MODULE_NOT_FOUND' (and that the message references franc-min) before logging this, and otherwise rethrow or log the original error details.
| console.error('WARNING: franc-min package not found. Language detection will be limited to feed-declared languages only.'); | |
| console.error('To enable automatic language detection, please run: npm install'); | |
| if (e && e.code === 'MODULE_NOT_FOUND' && (e.message || '').includes('franc-min')) { | |
| console.error('WARNING: franc-min package not found. Language detection will be limited to feed-declared languages only.'); | |
| console.error('To enable automatic language detection, please run: npm install'); | |
| } else { | |
| console.error('ERROR: Failed to initialize franc-min language detection. Falling back to feed-declared languages only.'); | |
| console.error(e); | |
| } |
The error handler for missing
franc-minlogged "franc-min not available, using feed-declared language only" without telling users how to fix it.Changes
npm installwhen the package is missingThis addresses the review feedback that error messages should be informative and include instructions for resolution.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.